<!-- inc:header -->
<div class="notice"><div class="p">
	<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td><span class="lead">&nbsp;&raquo; 回复评论列表</span></td>
		<td>
			<table>
			<form method="post" action="#" onsubmit="to_search();return false;">
			<tr>
				<td>回复搜索：</td>
				<td>
					<select name="status" id="status">
						<option value="">不限审核</option>
						<option value="1"{if($status == 1)} selected{end}>已审核</option>
						<option value="2"{if($status == 2)} selected{end}>未审核</option>
					</select>
				</td>
				<td>&nbsp; 时间：</td>
				<td><input type="text" name="startdate" id="startdate" onfocus="show_date('startdate')" style="width:75px;" value="{:$startdate}"></td>
				<td>&nbsp;－&nbsp;</td>
				<td><input type="text" name="enddate" id="enddate" onfocus="show_date('enddate')" style="width:75px;" value="{:$enddate}"></td>
				<td>&nbsp; 关键字：</td>
				<td>
					<select name="keytype" id="keytype">
						<option value="title">主题</option>
						<option value="username"{if($keytype == "username")} selected{end}>昵称</option>
					</select>
				</td>
				<td><input type="text" name="keywords" value="{:$keywords}" id="keywords"></td>
				<td><input type="submit" value="搜索" class="btn2"></td>
			</tr>
			</form>
			</table>
		</td>
	</tr>
	</table>
</div></div>

<div class="main">
<table width="100%" style="layout:fixed;" cellpadding="0" cellspacing="0">
<tr>
	<td class="t_sub" width="40px">&nbsp;</td>
	<td class="t_sub" width="50px">ID</td>
	<td class="t_sub" width="35px">状态</td>
	<td class="t_sub">回复标题</td>
	<td class="t_sub">主题</td>
	<td class="t_sub" width="35px">星数</td>
	<td class="t_sub" width="150px">发布时间</td>
	<td class="t_sub" width="45px">操作</td>
</tr>
<!-- $rslist AS $key=>$value -->
<tr class="tr_out" onMouseOver="over_tr(this)" onMouseOut="out_tr(this)">
	<td align="center" class="tc_left" rowspan="2"><input type="checkbox" value="{:$value[id]}"></td>
	<td align="center" class="tc_right">{:$value[id]}</td>
	<td align="center" class="tc_right" id="status_{:$value[id]}"><a href="javascript:to_status({:$value[id]},{:intval($value[status])});void(0);" class="status{:intval($value['status'])}"></a></td>
	<td class="tc_right">&nbsp;{:$value[title]}<!-- if($value[admreply] || $value[replydate]) --> <span style="color:darkblue;">（管理员已回复）</span><!-- end --> <!-- if($value[ifbest]) --><span class="red">[精华]</span><!-- end -->
	<td class="tc_right">&nbsp;（{:$value[tid]}）{:$value[t_title]}</td>
	<td class="tc_right" align="center">{:intval($value[star])}</td>
	<td class="tc_right" align="center">{:date("Y-m-d H:i:s",$value[postdate])}</td>
	<td class="tc_right" rowspan="2">
		<a href="{:site_url('reply,set')}id={:$value[id]}" class="btn edit" title="编辑"></a>
		<a href="javascript:to_del({:$value[id]});void(0);" class="btn del" title="删除"></a>
	</td>
</tr>
<tr class="tr_out">
	<td class="tc_right" colspan="5"><div style="padding:2px 5px;">&nbsp;<span class="darkblue">内容：</span>{:$value[content]}</div></td>
</tr>
<!-- end -->
</table>
</div>
<div class="table">
	<table width="100%">
	<tr>
		<td>
			<input type="button" value="全选" onclick="select_all()" class="btn2">
			<input type="button" value="全不选" onclick="select_none()" class="btn3">
			<input type="button" value="反选" onclick="select_anti()" class="btn2">
			&nbsp;
			<input type="button" value="批量审核" onclick="update_pl('1')" class="btn4">
			<input type="button" value="批量未审核" onclick="update_pl('0')" class="btn4">
			&nbsp;
			<input type="button" value="批量删除" onclick="del_pl()" class="btn4">
		</td>
		<td align="right">{:$pagelist}</td>
	</tr>
	</table>
</div>

<script type="text/javascript">
function to_search()
{
	url = base_url;
	//状态
	var st = getid("status").value;
	if(st)
	{
		url += "status="+st+"&";
	}
	var startdate = getid("startdate").value;
	if(startdate)
	{
		url += "startdate="+EncodeUtf8(startdate)+"&";
	}
	var enddate = getid("enddate").value;
	if(enddate)
	{
		url += "enddate="+EncodeUtf8(enddate)+"&";
	}
	var keytype = getid("keytype").value;
	var keywords = getid("keywords").value;
	if(keytype && keywords)
	{
		url += "keytype="+EncodeUtf8(keytype)+"&keywords="+EncodeUtf8(keywords)+"&";
	}
	direct(url);
	return false;
}
function update_pl(st)
{
	var id = join_checkbox();
	if(!id)
	{
		alert("请选择要更新的回复");
		return false;
	}
	var url = base_url + base_func + "=pl_status&status="+st+"&id="+id;
	var msg = get_ajax(url);
	if(msg == "ok")
	{
		direct(window.location.href);
		return true;
	}
	else
	{
		if(!msg) msg = "error: 操作错误";
		alert(msg);
		return false;
	}
}
function del_pl()
{
	var id = join_checkbox();
	if(!id)
	{
		alert("请选择要删除的回复");
		return false;
	}
	var qc = confirm("确定要删除该回复吗？删除后是不能恢复！");
	if(qc == "0")
	{
		return false;
	}
	var url = base_url + base_func + "=del&id="+id;
	var msg = get_ajax(url);
	if(msg == "ok")
	{
		direct(window.location.href);
		return true;
	}
	else
	{
		if(!msg) msg = "error: 操作错误";
		alert(msg);
		return false;
	}
}
function to_del(id)
{
	var qc = confirm("确定要删除该回复吗？删除后是不能恢复！");
	if(qc == "0")
	{
		return false;
	}
	var url = base_url + base_func + "=del&id="+id;
	var msg = get_ajax(url);
	if(msg == "ok")
	{
		direct(window.location.href);
		return true;
	}
	else
	{
		if(!msg) msg = "error: 操作错误";
		alert(msg);
		return false;
	}
}

function to_status(id,t)
{
	var url = base_url + base_func + "=status&id="+id;
	var msg = get_ajax(url);
	if(msg == "ok")
	{
		var n_t = t == 1 ? 0 : 1;
		$("#status_"+id+" > a").attr("class","status"+n_t);
		$("#status_"+id+" > a").attr("href","javascript:to_status("+id+","+n_t+");void(0)");
		return true;
	}
	else
	{
		if(!msg) msg = "error: 操作错误";
		alert(msg);
		return false;
	}
}
</script>
<!-- inc:footer -->